package com.test.spring.factorybean;

import org.springframework.beans.factory.FactoryBean;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/9/26 21:45
 * <p>
 * 自定义FactoryBean需要实现FactoryBean接口
 */
public class CarFactoryBean implements FactoryBean {

    private String brand;

    public void setBrand(String brand) {
        this.brand = brand;
    }

    @Override
    public Object getObject() throws Exception {
        return new Car(brand, 500000);
    }

    @Override
    public Class<?> getObjectType() {
        return Car.class;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }
}
